<?php

	function smarty_modifier_substr ( $param, $len = 0 ) {
		if ( strlen($param) <= $len) return $param;

		$tmpstr = "";
		for ( $i = 0; $i < $len; $i++) {
			if ( ord( substr( $param, $i, 1)) > 0xa0) {
				$tmpstr .= substr($param, $i, 2);
				$i++;
			} else $tmpstr .= substr($param, $i, 1);
		}
		$tmpstr .= "..";
		return $tmpstr;
	}

?>